The present disclosure relates generally to audio playback in electronic devices, and more particularly to crossfading during audio playback
This section is intended to introduce the reader to various aspects of art that may be related to various aspects of the present disclosure, which are described and/or claimed below. This discussion is believed to be helpful in providing the reader with background information to facilitate a better understanding of the various aspects of the present disclosure. Accordingly, it should be understood that these statements are to be read in this light, and not as admissions of prior art.
Electronic devices are widely used for a variety of tasks. Among the functions provided by electronic devices, audio playback, such as playback of music, audiobooks, podcasts, lectures, etc., is one of the most widely used. Such electronic devices may play audio tracks stored as audio files encoded in a number of different formats (e.g., MPEG-1 Audio Layer 3 (MP3), Advanced Audio Coding (AAC), etc.). The audio file may typically be stored in non-volatile memory, and may be accessed, decoded, and output as audio playback.
During playback, it may be desirable to have an audio stream, i.e., audio track, “fade” out while another audio stream fades in. Such a technique is referred to as “crossfading.” For example, the end of a first audio stream may be slowly faded out (e.g., by decreasing the playback volume of the track), and the beginning of a second audio stream may be slowly faded in (e.g., by increasing the playback volume of the track).
Typically, crossfading may be performed by decoding and buffering each of the first and second audio tracks, retrieving the buffered data, and mixing the buffered data sample by sample to generate a crossfaded output of the two audio tracks. The mixed data may be buffered and accessed for processing and output to an audio output device (e.g., headphone, speakers, etc.). Such crossfade methods may generally be performed for scheduled crossfades (e.g., in a set playlist of audio files) with little or no latency, as a decoder may begin to decode a second audio track before and in anticipation of a scheduled crossfade. However, crossfades may not always be scheduled or anticipated, as a user may desire to change from one audio track to a number of different audio tracks at any time during playback, before the first audio track has completely played. As electronic devices offer increasingly flexible user interface options which allow a user to command such unscheduled transitions between audio tracks, typical crossfading methods may result in latency or other undesirable playback effects.